package org.jsola.hr.query;

import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;
import org.jsola.core.query.BaseQuery;

/**
 * 员工查询条件
 *
 * @author zhr
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
public class EmpReduceQuery extends BaseQuery {

    private static final long serialVersionUID = 1L;

    @ApiParam(value = "员工名称或手机号")
    private String empNameOrPhone;

    @ApiParam(value = "是否只是user的用户,null:全部,true:是用户,false:不是用户")
    private Boolean onlyUser;

    @ApiParam(value = "在职还是离职,null:全部,true:在职,false:离职")
    private Boolean isOnlineOrLeave;

    @ApiParam(value = "是否校验用户分管地区,true:校验,false:不校验")
    private Boolean checkCity;

    @ApiParam(value = "是否在部门中,null:全部,true:在部门中,false:非部门员工")
    private Boolean inDep;

    public String getEmpNameOrPhone() {
        if (StringUtils.isNotEmpty(empNameOrPhone)) {
            // 中文标点处理
            return empNameOrPhone.replaceAll("，", ",");
        }
        return empNameOrPhone;
    }
}

